<?php
	include 'php/config.php';
	session_start();
	if (!isset($_SESSION["id_utente"])) {
		header("Location: " . $ISSUER_HOST . "/login.php");
		exit();
	} else if (!$_SESSION["admin"]) {
		header("Location: " . $ISSUER_HOST . "/forbidden.html");
		exit();
	}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF8">
<script src="js/utils.js"></script>
<script src="js/new_user.js"></script>
<title>Open Badges - Nuovo Utente</title>
</head>
<body>
<h1>Nuovo utente</h1>
<form method="post">
<table border="0">
	<tr>
		<td><label>Cognome</label></td>
		<td><input id="lastName" name="lastname" type="text" maxLength="70" /></td>
		<td id="lastNameMsg"></td>
	</tr>
	<tr>
		<td><label>Nome</label></td>
		<td><input id="name" name="name" type="text" maxLength="70" /></td>
		<td id="nameMsg"></td>
	</tr>
	<tr>
		<td><label>E-mail</label></td>
		<td><input id="email" name="email" type="text" maxLength="70" /></td>
		<td id="emailMsg"></td>
	</tr>
	<tr>
		<td><label>Admin</label></td>
		<td><input id="admin" name="admin" type="checkbox" value="admin" onchange="alertAdmin(this)" /></td>
	</tr>
</table>
<div id="message"></div>
<input id="create" type="button" value="Crea" onclick="validateNewUserForm()"/>
</form>
<div>
	<p>Torna alla <a href="index.html">Home</a></p>
</div>
</body>
</html>
